<%
Class CategoryModel
	Public Sub init
		db.tableName = "category"
		db.prikey	= "cat_id"
	End Sub
	
	Function Save
		on error resume next
		dim data,fileName
		set data = POP_MVC.post("")		
		call db.data( data )
		fileName = POP_MVC.Upload("file")
		if not isEmpty( fileName ) Then
			data("cover_path") = fileName
		End If		
		Save = False
		if db.create(1) Then			
			if db.Save() > 0 Then
				Save = True
			End If
		End if	
		set data = nothing
		call L_("")
	End Function

	Function Add
		on error resume next
		dim data,fileName
		set data = POP_MVC.post("")		
		call db.data( data )
		fileName = POP_MVC.Upload("file")
		if not isEmpty( fileName ) Then
			data("cover_path") = fileName
		End If		
		Add = False
		if db.create(1) Then			
			if db.Add() > 0 Then				
				Add = True
			end If			
		End if	
		set data = nothing
	End Function
	

End Class
%>